package com.blb.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.community.entity.SysDictData;
import com.blb.community.entity.vo.DictDataVo;
import com.blb.community.mapper.SysDictDataMapper;
import com.blb.community.service.ISysDictDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 字典数据表 服务实现类
 * </p>
 *
 * @author 帅帅
 * @since 2022-07-02
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService {

    @Resource
    private SysDictDataMapper sysDictDataMapper;

    /**
     * 分页查询+模糊查询
     * @param page
     * @param dictDataVo
     * @return
     */
    @Override
    public IPage<SysDictData> getAllSysDictData(IPage<SysDictData> page, DictDataVo dictDataVo) {
        return sysDictDataMapper.selectAllSysDictData(page,dictDataVo);
    }

    /**
     * 根据字典类型查询字典数据
     * @param dictType
     * @return
     */
    @Override
    public List<SysDictData> getSysDictDataByType(String dictType) {
        return sysDictDataMapper.selectSysDictDataByType(dictType);
    }

    @Override
    public IPage<SysDictData> selectSysDictDataByType(IPage<SysDictData> page,DictDataVo dictDataVo) {
        return sysDictDataMapper.selectSysDictDataByType(page,dictDataVo);
    }

    @Override
    public void logicDeleteDictData(Long dictCode) {
        sysDictDataMapper.logicDeleteDictData(dictCode);
    }
}
